<?php
include 'all.class.php';
header("Content-type: text/html; charset=utf-8"); 
$key="anshijie";//解密秘钥
$url=passport_decrypt($_POST["download"],$key);
$iipp=GetIP();
$urltemp=str_ireplace("http://", "", $url);
$url='http://'.$urltemp;
echo $iipp;

if (strpos($url,"baidu"))
	{
$file=file_get_contents($url);
if	(strpos($url,"请输入提取密码"))	
	{
		echo $url;
		echo "该文件已被上传者加密";
	} else {
	baidu($url,$iipp);//解析百度地址
	}

}
	
else if (strpos($url,"xunlei"))
	{
		$ch = curl_init();
		curl_setopt($ch, CURLOPT_URL, "$url");
		curl_setopt($ch, CURLOPT_HTTPHEADER, array("X-FORWARDED-FOR:$iipp", "CLIENT-IP:$iipp"));  //构造IP
		curl_setopt($ch, CURLOPT_REFERER,$iipp);   //构造来路
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
		$file = curl_exec($ch);
		//echo $file;
			if (strpos($file,"webfilemail_interface"))
					{	//$tempurl= $url."/webfilemail_interface";
					$filetemp=str_ireplace("/webfilemail_interface", "http://kuai.xunlei.com/webfilemail_interface", $file);
						echo '<strong style="font-size: 35px;">输入验证码后请关闭网页 重新查看！！！<br ></strong><br >';
						echo "<br >$onlineip";
						echo $filetemp;
						exit;
	
						}
				$pattern='/file_url=(.*?) file/';
				preg_match_all($pattern,$file,$result);
				$tempurl=implode("",$result[1]);
				$fileurlt=str_replace("\"","",$tempurl);
				$fileurl=str_replace("&amp;","&",$fileurlt);
				curl_close($ch);
		
				wjdz($fileurl);
				//header("location:$fileurl");
				/*$url = $fileurl;
				echo $url;
				echo "<script language='javascript' type='text/javascript'>";
				echo "window.location.href='$url'";
				echo "</script>";*/

	}